package com.miao.service;

import com.miao.base.model.RestResponse;
import com.miao.dto.MediaFilesDto;
import com.miao.dto.MediaParamsDto;
import com.miao.pojo.MediaFiles;
import com.baomidou.mybatisplus.extension.service.IService;

import java.io.File;

/**
 * <p>
 * 媒资信息 服务类
 * </p>
 *
 * @author author
 * @since 2024-02-03
 */
public interface IMediaFilesService extends IService<MediaFiles> {
    //上传文件deservice
    public MediaFilesDto upLoadFile(Long comId, MediaParamsDto mediaParamsDto, String localPath, String obiectName);
    //上传信息到数据库
    public MediaFiles addToDataBase(String md5OfFile, MediaParamsDto mediaParamsDto, Long comId, String objectName, String bucket);
    //检查文件是否已经传送
    public RestResponse<Boolean> checkFile(String fileMd5);
    //检查大文件分块是否已经传送
    public RestResponse<Boolean> checkchunk(String fileMd5, int chunkIndex);
    //上传分块
    public RestResponse<Boolean> upLoadChunk(String fileMd5, int chunk, String localPath);
    //合并分块
    public RestResponse<Boolean> emergeChunks(Long comId, String fileMd5, int total, MediaParamsDto mediaParamsDto);
    //视频文件传入minio后，将这些视频放入待转码表中
    public void addToWaitingTask(MediaFiles mediaFiles);
    //下载文件
    public File downLoadFiles(String bucket, String objectName);
    //上传文件到minio
    public boolean addToMinio(String localPath, String mimeType, String bucket, String objectName);
    //根据文件md5得到文件目录路径（对象名）
    public String getBigFilePath(String md5File, String extension);
    //获取文件的md5
    public String getMd5OfFile(File file);
}
